home *** CD-ROM | disk | FTP | other *** search
- /********************************************************************************/
- /* */
- /* close.c - close request processing. */
- /* */
- /* Richard W. Mincher. February 19, 1990. */
- /* */
- /* Copyright © 1990 Apple Computer, Inc. All rights reserved. */
- /* */
- /********************************************************************************/
-
- #include "AROSE.h"
- #include "os.h"
- #include "managers.h"
-
- #include "ARDriver.h"
- #include "ARTask.h"
-
- pascal void illegal()
- extern 0x4afc;
-
- CloseCall()
- {
- short s;
- AROSEmessage *m;
- tid_type temp;
-
- #ifdef DEBUG
- printf("Close received.\n");
- #endif DEBUG
- open = 0;
-
- // Disable pesky SCC interrupts.
-
- s = Spl(7);
- *SCCControl = 0x09;
- #ifdef PORTA
- *SCCControl = 0x80;
- #endif
- #ifdef PORTB
- *SCCControl = 0x40;
- #endif
- (void)Spl(s);
-
- // Reply to outstanding Write requests.
-
- while(m = G->txQHead)
- {
- G->txQHead = G->txQHead->mNext;
- temp = m->mFrom;
- m->mFrom = m->mTo;
- m->mTo = temp;
- m->mStatus = -27;
- m->mCode |= 1;
- Send(m);
- }
-
- // Reply to outstanding Read requests.
-
- while(m = G->rxQHead)
- {
- G->rxQHead = G->rxQHead->mNext;
- temp = m->mFrom;
- m->mFrom = m->mTo;
- m->mTo = temp;
- m->mStatus = -27;
- m->mCode |= 1;
- Send(m);
- }
-
-
- // Free transmit buffer.
-
- FreeMem( G->txFirst );
- if (G->txSignal)
- FreeMsg( G->txSignal );
-
- // Free receive and buffer.
-
- FreeMem( G->rxFirst );
- if (G->rxSignal)
- FreeMsg( G->rxSignal );
- }
-
-